function LoadTable( tablename )
%LOADTABLE Internally used to retrieve a datatable from file
global Database;

datatableFilename = [Database.Path.DatabaseStorage tablename '.datatable'];

if exist(datatableFilename, 'file')
    X = load([Database.Path.DatabaseStorage tablename '.datatable'], '-mat');
    % X needs to contain 2 vars, tablename and tablename_header..
    tablename_header = [tablename '_header'];
    
    % Checking header:
    if all((size(Database.(tablename_header)) == size(X.(tablename_header)))) && ...
            all(strcmpi(Database.(tablename_header), X.(tablename_header)))
        
        % Restoring data
        Database.(tablename) = X.(tablename);
        disp(['Datatable ' tablename ' restored. (Holding ' num2str(size(Database.(tablename),1)) ' records x ' num2str(size(Database.(tablename),2)) ' fields)']);
        
    else
        error(['You are trying to load data into ' tablename ', but the header in the file doesn''t match the one in memory. Delete the file (' datatableFilename ') manually to fix this error. (Note: You will lose the data that is stored in that file.)'])
    end
    
else
    disp('Datafile not found, no data restored.')
end


end